home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr05 / xnot12a.zip / JAM.H < prev    next >
C/C++ Source or Header  |  1993-06-16  |  9KB  |  310 lines

  1. /* This header defines both enhancements to emacs (ie. the gnu-like 
  2. * behavior of preloading the current file's path into the cmd line 
  3. * when opening a new file) and contants which allow emacs to run
  4. * under MS Windows (3.1 and NT) or X11 as if the window were a 
  5. * terminal. Minimal window-awareness was added; simple mouse support for 
  6. * setting insert point, setting mark, resizing via mode line, select of a 
  7. * region, scrolling and shortcuts to dir functions as well as basic 
  8. * clipboard (text only) support for MSW platforms. Also, simple printing can 
  9. * be supported on MSW by defining DOPRINT in this file. Drag&drop is also 
  10. * supported for MSW.
  11. */
  12.  
  13. /* Various defines for the message boxes, etc
  14. */
  15. #define AppName        "notgnu"
  16. #define AppQuestion    "notgnu Question"
  17. #define AppMsg        "notgnu Message"
  18. #define AppJob        "notgnu Subtask"
  19.  
  20. /* wwwwwwwwwwwwwwwwwwwwwww Windows 3.1 / NT wwwwwwwwwwwwwwwwwwwwwwwwwww
  21. */
  22. # ifdef MSW     
  23. #  include <windows.h>
  24. #  include "string.h"
  25. #  define HUGE far
  26. #  define FAT           /* DOS FILESYSTEM STUFF, ie no native filesystem 
  27.                            support for NT at this time; only FAT */
  28. #  ifndef F_OK
  29. #   define F_OK    0
  30. #   define X_OK    1
  31. #   define W_OK    2
  32. #   define R_OK    4
  33. #  endif
  34.  
  35. #  define WINDOWED    /* windowed terminal device */
  36. #  /* define DOPRINT     simple print for MSW only */
  37.  
  38. #  define NROW   300        /* Max Rows.              */
  39. #  define NCOL   200        /* Max Columns.          */
  40.  
  41. #  ifdef SLOWSERVER
  42. #    ifndef WIN32        /* 64k seg limit */
  43. #      undef NROW
  44. #      undef NCOL
  45. #      define NROW   50        /* Max Rows.              */
  46. #      define NCOL   100    /* Max Columns.          */
  47. #    endif
  48. #  endif
  49.  
  50.    /* For vertical scrollbar, define this (never completed!)
  51.    */
  52. # if 0
  53. #  define VBAR
  54. # endif
  55.  
  56.    /* For blinking window's cursor, define this
  57.    */
  58. # if 1
  59. #  define WINDOWS_CURSOR 
  60. # endif
  61.  
  62.   /* For silly spinning cursor during make
  63.   */
  64. #if 0 /* see me.rc if you change this!!! */
  65. # define DOGRINDER
  66. #endif
  67.  
  68. #  define FONTSIZE 14        /* default size in pixels */
  69.  
  70. #  define TIME_INC (130)
  71. #  define INCS_PER_UPDATE  10                 /* used for window title update */
  72. #  define INCS_PER_SEC   8
  73. #  define INCS_PER_SLEEP 4                   /* used by sleep */
  74. #  define INCS_PER_SAVE (INCS_PER_SEC * 6)   /* IncrementalSave every ~N secs */
  75. #  define SAVE_DELAY INCS_PER_SAVE
  76. #  define DELAY_TO_SCROLL 0             /* fast as possible */
  77.  
  78.    /* globals for Windows things
  79.    */
  80. #  ifndef W3WIN_C
  81.      extern HANDLE   g_hInstance;
  82.      extern HWND     g_hWnd;
  83.      extern HDC      g_hDC;
  84.      extern int      g_nLineHeight, g_nCharWidth;
  85.      extern UINT     g_idTimer;
  86.      extern int      g_caret_x, g_caret_y;
  87.      extern HFONT    g_hfont; 
  88.      extern HFONT    g_oldFont;
  89.      extern BOOL     g_caret;
  90.      extern BOOL     g_hasFocus;
  91.      extern char     *g_APPNAME;
  92.      extern BOOL     g_menu;
  93.      extern BOOL     edInited;
  94. #endif /* W3WIN_C */
  95.  
  96. /* function macros
  97. */
  98. #define IsCaretCreated() (g_caret & 1)
  99. #define IsCaretVis()     ((g_caret & 2) && IsCaretCreated())
  100. #define SetCaretCreated(flg)  {if (flg) g_caret |= 1; else g_caret &= ~1;}
  101. #define MakeCaretVis(flg)  {if (flg) g_caret |= 2; else g_caret &= ~2;}
  102. #define SetCaretVis(flg)\
  103.   {\
  104.   if (flg && !IsCaretVis() && !IsIconic(g_hWnd)) \
  105.     DoShowCaret(g_hWnd);\
  106.   else if (!flg && IsCaretVis())\
  107.     DoHideCaret(g_hWnd);\
  108.   }
  109.  
  110. # endif  /* MSW */
  111. /* wwwwwwwwwwwwwwwwwwwwwwwwww Windows 3.+ / NT wwwwwwwwwwwwwwwwwwwwwwwwwwww */
  112.  
  113. /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  114. */
  115. # ifdef X11
  116. #  define SomeUnix
  117. #  ifdef SUN
  118. #    define sun
  119. #  endif
  120. #  define WINDOWED    /* windowed terminal device */
  121.  
  122. #  include "Xmd.h"
  123. #  include "Xlib.h"
  124. #  include "Xutil.h"
  125. #  include "cursorfont.h"
  126.  
  127. #  define NROW   300            /* Max Rows.              */
  128. #  define NCOL   200            /* Max Columns.          */
  129. #  define TIME_INC (120000)        /* 1/4 sec in microsecs */
  130. #  define INCS_PER_UPDATE  (1)            /* used for window title update */
  131. #  define INCS_PER_SLEEP 3
  132. #  define INCS_PER_SEC   6
  133. #  define INCS_PER_SAVE (INCS_PER_SEC * 6)  /* IncrementalSave every N secs */
  134. #  define SAVE_DELAY INCS_PER_SAVE
  135. #  define DELAY_TO_SCROLL 0            /* fast as possible */
  136.  
  137.    typedef struct 
  138.     {int top, bottom, left, right;} RECT;   /* WINDOW's lookalike */
  139.  
  140.    typedef int HANDLE; 
  141.    typedef int WPARAM;
  142.    typedef int HWND;
  143.    typedef long LPARAM;
  144.    typedef unsigned int UINT;
  145.    typedef int WORD;
  146.    typedef long COLORREF;
  147. #  ifndef BOOL
  148. #    define BOOL int
  149. #  endif /* BOOL */
  150. #  define HUGE
  151.  
  152. #  ifndef XWIN_C
  153.      extern Display *gDpy;
  154.      extern Window gWindow;
  155.      extern XFontStruct *gFont;
  156.      extern XCharStruct *gXchar;
  157.      extern GC gText;       /* for drawing text */
  158.      extern GC gTouchedText;/* for drawing touched text */
  159.      extern GC gMode;       /* for drawing modeline */
  160.      extern GC gXor;       /* for cursor */
  161.      extern char *g_APPNAME;
  162.      extern int g_nLineHeight, g_nCharWidth, g_nLineAscent;
  163.      extern int g_caret_x, g_caret_y;
  164.      extern BOOL g_caret;
  165.      extern BOOL g_hasFocus;
  166.      extern BOOL edInited;
  167. #  endif  /* XWIN_C */
  168.  
  169. /* function macros
  170. */
  171. #define IsCaretCreated() (g_caret & 1)
  172. #define IsCaretVis()     ((g_caret & 2) && IsCaretCreated())
  173. #define SetCaretCreated(flg)  {if (flg) g_caret |= 1; else g_caret &= ~1;}
  174. #define MakeCaretVis(flg)  {if (flg) g_caret |= 2; else g_caret &= ~2;}
  175. #define SetCaretVis(flg)\
  176.   {\
  177.   if (flg && !IsCaretVis()) \
  178.    DoShowCaret();\
  179.   else if (!flg && IsCaretVis())\
  180.    DoHideCaret();\
  181.   }
  182.  
  183. #  define ringbell() XBell(gDpy,0)
  184.  
  185.    /* These font names worked well on the instance of the following
  186.    * systems I had access to; variations of X11 R4 and R5. 
  187.    * Override it on the command line, or here...
  188.    */
  189. #  ifdef ULTRIX
  190. #    define def_fontname "term*10*" 
  191. #  endif
  192. #  ifdef INTERACTIVE
  193. #    define def_fontname "cou*10*" 
  194. #  endif
  195. #  ifdef SOL
  196. #    define def_fontname "6x13" 
  197. #  endif
  198.  
  199. #  ifdef HP
  200. #    define def_fontname "cour*12*" 
  201. #  endif
  202.  
  203. #  ifndef def_fontname
  204. #    define def_fontname "fixed"
  205. #  endif
  206.  
  207. #  define yCharPos(y) ((y) + gXchar->ascent + 1)
  208. #  define WinWidth()  (g_nCharWidth * (ncol + 1))
  209. #  define WinHeight() (g_nLineHeight * (nrow + 1))
  210. #  define NoClipping() NewClipping(0, 0, -1, -1)
  211.  
  212. #  define FudgeHeight 2
  213. #  define FudgeHeight2 0
  214. #  define FudgeEdge 2
  215. # endif  /* X11 */
  216. /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx X11 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
  217.  
  218. /* ddddddddddddddddddddddddddddd DOS ddddddddddddddddddddddddddddddddddddd */
  219. /* ccccccccccccccccccccccccccccc CURSES cccccccccccccccccccccccccccccccccc */
  220.  
  221. # if defined(MSC) || defined(CURSES)
  222. #  ifdef MSC
  223. #   define FAT           /* DOS FILESYSTEM STUFF */
  224. #  endif
  225.  
  226. #  ifdef CURSES
  227. #    include <curses.h>
  228. #  endif
  229.  
  230. #  ifndef F_OK
  231. #   define F_OK    0
  232. #   define X_OK    1
  233. #   define W_OK    2
  234. #   define R_OK    4
  235. #  endif
  236.  
  237. #  define TIME_INC (130)
  238. #  define INCS_PER_UPDATE  10                 /* used for window title update */
  239. #  define INCS_PER_SEC   8
  240. #  define INCS_PER_SLEEP 6                   /* used by sleep */
  241. #  define INCS_PER_SAVE (INCS_PER_SEC * 6)   /* IncrementalSave every ~N secs */
  242. #  define SAVE_DELAY INCS_PER_SAVE
  243. #  define DELAY_TO_SCROLL 0             /* fast as possible */
  244.  
  245.   /* moved from ttydef.h - NOTE presumes that GOSLING is not defined 
  246.   * for MSW platform else NROW makes VIDEO struct overflow 
  247.   * 64k array size (pukie segmented machines!)
  248.   */
  249. #  ifdef MSC
  250. #   define NROW            60        /* Max Rows.              */
  251. #   define NCOL            130        /* Max Columns.          */
  252. #  else
  253. #   define NROW            300
  254. #   define NCOL            200
  255. #  endif
  256.  
  257. #  define IsCaretCreated() 
  258. #  define IsCaretVis()        FALSE
  259. #  define SetCaretCreated(flg)  
  260. #  define SetCaretVis(flg) 
  261. #  define HUGE 
  262.  
  263.    typedef int HANDLE; 
  264.    typedef int WPARAM;
  265.    typedef long LPARAM;
  266.    typedef unsigned int UINT;
  267.    typedef int WORD;
  268.    typedef int HWND;
  269.    typedef long COLORREF;
  270.    typedef struct 
  271.     {int top, bottom, left, right;} RECT;   /* WINDOW's lookalike */
  272.  
  273. #  ifndef BOOL
  274. #    define BOOL int
  275. #  endif /* BOOL */
  276.  
  277. # endif /* MSC */
  278. /* ddddddddddddddddddddddddd DOS dddddddddddddddddddddddddddddddddddd */
  279. /* ccccccccccccccccccccccccccccc CURSES cccccccccccccccccccccccccccccccccc */
  280.  
  281. /* %%%%%%%%%%%%%%%%%%%%%%% System independent things %%%%%%%%%%%%%%%%%%%%% */
  282.  
  283. /* moved from def.h
  284. */
  285. #define CNONE    0            /* Unknown color.        */
  286. #define CTEXT    1            /* Text color.            */
  287. #define CMODE    2            /* Mode line color.        */
  288.  
  289. #ifdef WINDOWED    /* not bothering with DOS or terminal based.. */
  290. # define CHIGH   3            /* Special color         */
  291. #else
  292. # define CHIGH   CTEXT            /* Special color         */
  293. #endif
  294.  
  295. #define START_COLS 80
  296. #define START_LINES 25
  297.  
  298. #define MIN_FNAME_CHARS  6
  299. #define MAX_FNAME_CHARS 40        /* max chars of fname in mode line */
  300.  
  301. extern char     *g_APPNAME;
  302.  
  303. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% System defs %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
  304.  
  305. /* Define this if you want the filename of each buffer in the
  306. * mode line
  307. */
  308. #define SHOWFILENAME  
  309.  
  310.